<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>小红帽科技|草帽聚合支付 - 后台管理 - 交易列表</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="__ADMIN__/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="__ADMIN__/style/admin.css" media="all">
</head>
<body>

<div class="layui-fluid">
    <div class="layui-card">
        <!--头部-->
        <div class="layui-form layui-card-header layuiadmin-card-header-auto">
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">操作者ID</label>
                    <div class="layui-input-block">
                        <input type="text" name="uid" placeholder="请输入操作者ID" value="{$Request.get.uid}" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">模块</label>
                    <div class="layui-input-block">
                        <select name="module" lay-filter="channel">
                            <option value="">所有</option>
                            <option {$Request.get.module == 'admin' ? 'selected' : '' } value="admin">admin</option>
                            <option {$Request.get.module == 'index' ? 'selected' : '' } value="index">index</option>
                        </select>
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">开始时间</label>
                    <div class="layui-input-block">
                        <input type="text" name="start" class="layui-input app-laydate-item" placeholder="yyyy-MM-dd">
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">结束时间</label>
                    <div class="layui-input-block">
                        <input type="text" name="end" class="layui-input app-laydate-item" placeholder="yyyy-MM-dd">
                    </div>
                </div>
                <div class="layui-inline">
                    <button class="layui-btn layuiadmin-btn-order" lay-submit lay-filter="app-admin-log-list-search">
                        <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
                        搜素
                    </button>
                </div>
            </div>
        </div>
        <!--数据表-->
        <div class="layui-card-body">
            <div class="app-admin-log-list" style="padding-bottom: 10px;">
                <button class="layui-btn layuiadmin-btn-useradmin layui-btn-warm layui-btn-sm" data-type="batchdel">清空日志</button>
            </div>
            <table id="app-admin-log-list" lay-filter="app-admin-log-list"></table>
            <script type="text/html" id="table-system-order">
                <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i class="layui-icon layui-icon-delete"></i>删除</a>
            </script>
        </div>
    </div>
</div>

<script src="__ADMIN__/layui/layui.js"></script>
<script>
    layui.config({
        base: '__ADMIN__/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'actionlog','laydate', 'table'], function(){
        var $ = layui.$
            ,form = layui.form
            ,laydate = layui.laydate
            ,table = layui.table;

        //同时绑定多个日期
        lay('.app-laydate-item').each(function(){
            laydate.render({
                elem: this
                ,value: new Date()
                ,trigger: 'click'
            });
        });

        //监听搜索
        form.on('submit(app-admin-log-list-search)', function(data){
            var field = data.field;

            //执行重载
            table.reload('app-admin-log-list', {
                where: field
            });
        });

        //事件
        var active = {
            batchdel: function(){
                layer.prompt({
                    formType: 1
                    ,title: '敏感操作，请验证口令'
                }, function(value, index){
                    layer.close(index);
                    layer.confirm('确定清空日志吗？', function(index) {

                        //执行 Ajax 后重载
                        $.ajax({
                            url:'logClean',
                            method:'POST',
                            success:function (res) {
                                if (res.code == 1){
                                    table.reload('app-admin-log-list');
                                }
                                layer.msg(res.msg, {icon: res.code == 1 ? 1: 2,time: 1500});
                                layer.close(index); //关闭弹层
                            }
                        });
                    });
                });
            }
        };

        $('.layui-btn.layuiadmin-btn-useradmin').on('click', function(){
            var type = $(this).data('type');
            active[type] ? active[type].call(this) : '';
        });
    });
</script>
</body>
</html>